﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Sgr.ExceptionHandling
{
    /// <summary>
    /// 异常转换器接口，用于将异常转换为标准化的错误信息
    /// </summary>
    public interface IExceptionToErrorInfo
    {
        /// <summary>
        /// 将异常转换为适合日志记录的文本消息
        /// </summary>
        /// <param name="exception">需要转换的异常对象</param>
        /// <returns>包含异常详细信息的文本消息</returns>
        string TranslateToLog(Exception exception);

        /// <summary>
        /// 将异常转换为 ProblemDetails
        /// </summary>
        /// <param name="exception">需要转换的异常对象</param>
        /// <returns>包含HTTP状态码和问题详情的元组</returns>
        Tuple<int, ProblemDetails> ConvertToProblemDetails(Exception exception);
    }
}